package com.db.cm.app.service.impl;

import com.db.cm.app.model.PurchaseDO;
import com.db.cm.app.mapper.PurchaseMapper;
import com.db.cm.app.service.PurchaseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author YOURSLIHUA
 * @since 2023-11-24
 */
@Service
public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, PurchaseDO> implements PurchaseService {

    @Autowired
    private PurchaseMapper purchaseMapper;

    @Override
    public List<PurchaseDO> selectAll() {
        return purchaseMapper.selectList(null);
    }

    @Override
    public PurchaseDO selectById(String purchaseId) {
        return purchaseMapper.selectById(purchaseId);
    }

    @Override
    public boolean update(PurchaseDO entity) {
        return purchaseMapper.updateById(entity) > 0;
    }

    @Override
    public boolean add(PurchaseDO entity) {
        return purchaseMapper.insert(entity) > 0 ;
    }

    @Override
    public boolean delete(PurchaseDO entity) {
        return purchaseMapper.deleteById(entity) > 0;
    }
}
